package com.yf.dxapp.module.app.dal.mysql.teacher;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.yf.dxapp.module.app.controller.admin.teacher.vo.TeacherPageReqVO;
import com.yf.dxapp.module.app.dal.dataobject.teacher.TeacherDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 老师信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TeacherMapper extends BaseMapperX<TeacherDO> {

    default PageResult<TeacherDO> selectPage(TeacherPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeacherDO>()
                .eqIfPresent(TeacherDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(TeacherDO::getMobile, reqVO.getMobile())
                .likeIfPresent(TeacherDO::getName, reqVO.getName())
                .betweenIfPresent(TeacherDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TeacherDO::getId));
    }

}